home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 051-060 / amok52 / gadgeted / txt / req1.mod < prev    next >
Text File  |  1993-11-04  |  11KB  |  423 lines

  1. IMPLEMENTATION MODULE Req1;
  2. (* Erstellen einer Gadget-Struktur *)
  3.  
  4. FROM SYSTEM    IMPORT ADR,ADDRESS;
  5. FROM Intuition IMPORT NewWindow, WindowPtr, IDCMPFlags, IDCMPFlagSet,
  6.                       WindowFlags, WindowFlagSet, ScreenFlags,
  7.                       ScreenFlagSet, OpenWindow, CloseWindow,
  8.                       customScreen, Gadget, IntuiText, Border,
  9.                       StringInfo, PropInfo, GadgetFlagSet, 
  10.                       GadgetFlags, ActivationFlags, AddGList,
  11.                       ActivationFlagSet, boolGadget, strGadget,
  12.                       propGadget, PropInfoFlagSet, PropInfoFlags,
  13.                       RefreshGList;
  14. FROM Graphics  IMPORT jam1, jam2;
  15.  
  16.  
  17. TYPE XYTyp = ARRAY [0..9] OF INTEGER;
  18.      BufTyp = ARRAY [0..255] OF CHAR;
  19.  
  20. VAR GadgWindow : NewWindow;
  21.     WPtr       : WindowPtr;
  22.     Pos        : INTEGER;
  23.     Gadgets : ARRAY [0..5] OF Gadget;
  24.     Borders : ARRAY [0..6] OF Border;
  25.     XY      : ARRAY [0..3] OF XYTyp;
  26.     GText   : ARRAY [0..5] OF IntuiText;
  27.     SInfo   : ARRAY [0..1] OF StringInfo;
  28.     Buf     : ARRAY [0..1] OF BufTyp;
  29.     UBuf    : BufTyp;
  30.     PInfo   : ARRAY [0..2] OF PropInfo;
  31.     TChar   : ARRAY [0..5] OF CHAR;
  32.  
  33.  
  34. PROCEDURE InitReq1
  35.                         (VAR wptr   : ADDRESS;
  36.                              Screen : ADDRESS;
  37.                              Title  : ADDRESS);
  38. (* Aufbau der Gadget-Struktur im Window *)
  39.  
  40. BEGIN
  41.  
  42. (* Window aufbauen *)
  43. (*-----------------*)
  44.  
  45.  IF (wptr = NIL) THEN
  46.  
  47.    WITH GadgWindow DO
  48.      leftEdge := 75; topEdge := 19;
  49.      width := 481; height := 99;
  50.      detailPen := 0; blockPen := 1;
  51.      idcmpFlags := IDCMPFlagSet{gadgetDown,gadgetUp,closeWindow};
  52.      flags := WindowFlagSet{windowDrag,windowDepth,
  53.                             windowClose,activate};
  54.      firstGadget := ADR(Gadgets[0]);
  55.      checkMark := NIL;
  56.      title := Title;
  57.      screen := Screen;
  58.      bitMap := NIL;
  59.      minWidth := 30; minHeight := 20; maxWidth := 640; maxHeight := 256;
  60.      IF (Screen # NIL) THEN
  61.        type := customScreen;
  62.      ELSE
  63.        type := ScreenFlagSet{wbenchScreen};
  64.      END; (*IF*)
  65.    END; (*WITH*)
  66.  
  67.  END; (*IF*)
  68.  
  69. (*--------------------------------------------------------------------------*)
  70.  
  71. (* Aufbau der Gadget-Strukturen *)
  72. (*------------------------------*)
  73.  
  74.  WITH Gadgets[0] DO
  75.     nextGadget := ADR(Gadgets[1]);
  76.     leftEdge := 368;
  77.     topEdge := 79;
  78.     width := 70;
  79.     height := 9;
  80.     flags := GadgetFlagSet{};
  81.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  82.     gadgetType := boolGadget;
  83.     gadgetRender := ADR(Borders[0]);
  84.     selectRender := NIL;
  85.     gadgetText := ADR(GText[0]);
  86.     specialInfo := NIL;
  87.     gadgetID := 0;
  88.     userData := NIL;
  89.  END; (*WITH*)
  90.  
  91. (* Gadget-Text *)
  92.  WITH GText[0] DO
  93.     frontPen := 3; backPen := 0;
  94.     drawMode := jam2;
  95.     leftEdge := 27; topEdge := 1;
  96.     iTextFont := NIL;
  97.     iText := ADR('OK');
  98.     nextText := NIL;
  99.  END; (*WITH*)
  100.  
  101. (* Gadget-Border(s) *)
  102.  WITH Borders[0] DO
  103.     leftEdge := -2; topEdge := -2;
  104.     frontPen := 1; backPen := 0;
  105.     drawMode := jam2;
  106.     count := 5;
  107.     xy := ADR(XY[0]);
  108.     nextBorder := ADR(Borders[1]);
  109.  END; (*WITH*)
  110.  
  111.  XY[0,0] := 0;  XY[0,1] := 0; 
  112.  XY[0,2] := 73;  XY[0,3] := 0; 
  113.  XY[0,4] := 73;  XY[0,5] := 12; 
  114.  XY[0,6] := 0;  XY[0,7] := 12; 
  115.  XY[0,8] := 0;  XY[0,9] := 0; 
  116.  
  117.  WITH Borders[1] DO
  118.     leftEdge := -5; topEdge := -4;
  119.     frontPen := 1; backPen := 0;
  120.     drawMode := jam2;
  121.     count := 5;
  122.     xy := ADR(XY[1]);
  123.     nextBorder := NIL;
  124.  END; (*WITH*)
  125.  
  126.  XY[1,0] := 0;  XY[1,1] := 0; 
  127.  XY[1,2] := 79;  XY[1,3] := 0; 
  128.  XY[1,4] := 79;  XY[1,5] := 16; 
  129.  XY[1,6] := 0;  XY[1,7] := 16; 
  130.  XY[1,8] := 0;  XY[1,9] := 0; 
  131.  
  132. (*-------------------------------------------------------*)
  133.  
  134.  WITH Gadgets[1] DO
  135.     nextGadget := ADR(Gadgets[2]);
  136.     leftEdge := 47;
  137.     topEdge := 79;
  138.     width := 251;
  139.     height := 11;
  140.     flags := GadgetFlagSet{};
  141.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  142.     gadgetType := propGadget;
  143.     gadgetRender := ADR(Borders[2]);
  144.     selectRender := NIL;
  145.     gadgetText := ADR(GText[1]);
  146.     specialInfo := ADR(PInfo[0]);
  147.     gadgetID := 1;
  148.     userData := NIL;
  149.  END; (*WITH*)
  150.  
  151. (* Gadget-Text *)
  152.  WITH GText[1] DO
  153.     frontPen := 1; backPen := 0;
  154.     drawMode := jam2;
  155.     leftEdge := -14; topEdge := 2;
  156.     iTextFont := NIL;
  157.     TChar[0] := 'B';
  158.     TChar[1] := 00C;
  159.     iText := ADR(TChar[0]);
  160.     nextText := NIL;
  161.  END; (*WITH*)
  162.  
  163. (* Gadget-Border(s) *)
  164.  WITH Borders[2] DO
  165.     leftEdge := -2; topEdge := -2;
  166.     frontPen := 1; backPen := 0;
  167.     drawMode := jam2;
  168.     count := 5;
  169.     xy := NIL;
  170.     nextBorder := NIL;
  171.  END; (*WITH*)
  172.  
  173. (* Prop-Info *)
  174.  WITH PInfo[0] DO
  175.     flags := PropInfoFlagSet{autoKnob,freeHoriz};
  176.     horizPot := 0; vertPot := 0;
  177.     horizBody := 65535 DIV 16;
  178.     vertBody := 65535 DIV 16;
  179.  END; (*WITH*)
  180.  
  181. (*-------------------------------------------------------*)
  182.  
  183.  WITH Gadgets[2] DO
  184.     nextGadget := ADR(Gadgets[3]);
  185.     leftEdge := 47;
  186.     topEdge := 64;
  187.     width := 251;
  188.     height := 11;
  189.     flags := GadgetFlagSet{};
  190.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  191.     gadgetType := propGadget;
  192.     gadgetRender := ADR(Borders[3]);
  193.     selectRender := NIL;
  194.     gadgetText := ADR(GText[2]);
  195.     specialInfo := ADR(PInfo[1]);
  196.     gadgetID := 2;
  197.     userData := NIL;
  198.  END; (*WITH*)
  199.  
  200. (* Gadget-Text *)
  201.  WITH GText[2] DO
  202.     frontPen := 1; backPen := 0;
  203.     drawMode := jam2;
  204.     leftEdge := -14; topEdge := 2;
  205.     iTextFont := NIL;
  206.     TChar[2] := 'G';
  207.     TChar[3] := 00C;
  208.     iText := ADR(TChar[2]);
  209.     nextText := NIL;
  210.  END; (*WITH*)
  211.  
  212. (* Gadget-Border(s) *)
  213.  WITH Borders[3] DO
  214.     leftEdge := -2; topEdge := -2;
  215.     frontPen := 1; backPen := 0;
  216.     drawMode := jam2;
  217.     count := 5;
  218.     xy := NIL;
  219.     nextBorder := NIL;
  220.  END; (*WITH*)
  221.  
  222. (* Prop-Info *)
  223.  WITH PInfo[1] DO
  224.     flags := PropInfoFlagSet{autoKnob,freeHoriz};
  225.     horizPot := 0; vertPot := 0;
  226.     horizBody := 65535 DIV 16;
  227.     vertBody := 65535 DIV 16;
  228.  END; (*WITH*)
  229.  
  230. (*-------------------------------------------------------*)
  231.  
  232.  WITH Gadgets[3] DO
  233.     nextGadget := ADR(Gadgets[4]);
  234.     leftEdge := 47;
  235.     topEdge := 49;
  236.     width := 251;
  237.     height := 11;
  238.     flags := GadgetFlagSet{};
  239.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  240.     gadgetType := propGadget;
  241.     gadgetRender := ADR(Borders[4]);
  242.     selectRender := NIL;
  243.     gadgetText := ADR(GText[3]);
  244.     specialInfo := ADR(PInfo[2]);
  245.     gadgetID := 3;
  246.     userData := NIL;
  247.  END; (*WITH*)
  248.  
  249. (* Gadget-Text *)
  250.  WITH GText[3] DO
  251.     frontPen := 1; backPen := 0;
  252.     drawMode := jam2;
  253.     leftEdge := -14; topEdge := 2;
  254.     iTextFont := NIL;
  255.     TChar[4] := 'R';
  256.     TChar[5] := 00C;
  257.     iText := ADR(TChar[4]);
  258.     nextText := NIL;
  259.  END; (*WITH*)
  260.  
  261. (* Gadget-Border(s) *)
  262.  WITH Borders[4] DO
  263.     leftEdge := -2; topEdge := -2;
  264.     frontPen := 1; backPen := 0;
  265.     drawMode := jam2;
  266.     count := 5;
  267.     xy := NIL;
  268.     nextBorder := NIL;
  269.  END; (*WITH*)
  270.  
  271. (* Prop-Info *)
  272.  WITH PInfo[2] DO
  273.     flags := PropInfoFlagSet{autoKnob,freeHoriz};
  274.     horizPot := 0; vertPot := 0;
  275.     horizBody := 65535 DIV 16;
  276.     vertBody := 65535 DIV 16;
  277.  END; (*WITH*)
  278.  
  279. (*-------------------------------------------------------*)
  280.  
  281.  WITH Gadgets[4] DO
  282.     nextGadget := ADR(Gadgets[5]);
  283.     leftEdge := 240;
  284.     topEdge := 16;
  285.     width := 56;
  286.     height := 8;
  287.     flags := GadgetFlagSet{};
  288.     activation := ActivationFlagSet{relVerify,gadgImmediate,stringRight,longint};
  289.     gadgetType := strGadget ;
  290.     gadgetRender := ADR(Borders[5]);
  291.     selectRender := NIL;
  292.     gadgetText := ADR(GText[4]);
  293.     specialInfo := ADR(SInfo[0]);
  294.     gadgetID := 4;
  295.     userData := NIL;
  296.  END; (*WITH*)
  297.  
  298. (* Gadget-Text *)
  299.  WITH GText[4] DO
  300.     frontPen := 3; backPen := 2;
  301.     drawMode := jam2;
  302.     leftEdge := -188; topEdge := 1;
  303.     iTextFont := NIL;
  304.     iText := ADR('Number of Colors:');
  305.     nextText := NIL;
  306.  END; (*WITH*)
  307.  
  308. (* Gadget-Border(s) *)
  309.  WITH Borders[5] DO
  310.     leftEdge := -2; topEdge := -2;
  311.     frontPen := 1; backPen := 0;
  312.     drawMode := jam2;
  313.     count := 5;
  314.     xy := ADR(XY[2]);
  315.     nextBorder := NIL;
  316.  END; (*WITH*)
  317.  
  318.  XY[2,0] := 0;  XY[2,1] := 0; 
  319.  XY[2,2] := 59;  XY[2,3] := 0; 
  320.  XY[2,4] := 59;  XY[2,5] := 11; 
  321.  XY[2,6] := 0;  XY[2,7] := 11; 
  322.  XY[2,8] := 0;  XY[2,9] := 0; 
  323.  
  324. (* String-Info *)
  325.  WITH SInfo[0] DO
  326.     buffer := ADR(Buf[0]);
  327.     undoBuffer := ADR(UBuf);
  328.     bufferPos := 0; dispPos := 0;
  329.     maxChars := 80;
  330.     longInt := 0;
  331.  END; (*WITH*)
  332.  
  333. (*-------------------------------------------------------*)
  334.  
  335.  WITH Gadgets[5] DO
  336.     nextGadget := NIL;
  337.     leftEdge := 136;
  338.     topEdge := 32;
  339.     width := 160;
  340.     height := 8;
  341.     flags := GadgetFlagSet{};
  342.     activation := ActivationFlagSet{relVerify,gadgImmediate,stringCenter};
  343.     gadgetType := strGadget ;
  344.     gadgetRender := ADR(Borders[6]);
  345.     selectRender := NIL;
  346.     gadgetText := ADR(GText[5]);
  347.     specialInfo := ADR(SInfo[1]);
  348.     gadgetID := 5;
  349.     userData := NIL;
  350.  END; (*WITH*)
  351.  
  352. (* Gadget-Text *)
  353.  WITH GText[5] DO
  354.     frontPen := 2; backPen := 1;
  355.     drawMode := jam2;
  356.     leftEdge := -83; topEdge := 0;
  357.     iTextFont := NIL;
  358.     iText := ADR('Filename:');
  359.     nextText := NIL;
  360.  END; (*WITH*)
  361.  
  362. (* Gadget-Border(s) *)
  363.  WITH Borders[6] DO
  364.     leftEdge := -2; topEdge := -2;
  365.     frontPen := 1; backPen := 0;
  366.     drawMode := jam2;
  367.     count := 5;
  368.     xy := ADR(XY[3]);
  369.     nextBorder := NIL;
  370.  END; (*WITH*)
  371.  
  372.  XY[3,0] := 0;  XY[3,1] := 0; 
  373.  XY[3,2] := 163;  XY[3,3] := 0; 
  374.  XY[3,4] := 163;  XY[3,5] := 11; 
  375.  XY[3,6] := 0;  XY[3,7] := 11; 
  376.  XY[3,8] := 0;  XY[3,9] := 0; 
  377.  
  378. (* String-Info *)
  379.  WITH SInfo[1] DO
  380.     buffer := ADR(Buf[1]);
  381.     undoBuffer := ADR(UBuf);
  382.     bufferPos := 0; dispPos := 0;
  383.     maxChars := 16;
  384.     longInt := 0;
  385.  END; (*WITH*)
  386.  
  387. (*-------------------------------------------------------*)
  388.  
  389. (* Fenster öffnen: *)
  390.  IF (wptr = NIL) THEN
  391.     WPtr := OpenWindow (GadgWindow);
  392.     wptr := WPtr;
  393.  ELSE
  394.     Pos := AddGList (wptr,ADR(Gadgets[0]),0,6,NIL);
  395.     RefreshGList (ADR(Gadgets[0]),wptr,NIL,6);
  396.     WPtr := wptr;
  397.  END; (*IF*)
  398.  
  399. END InitReq1;
  400.  
  401. (*--------------------------------------------------------------------------*)
  402.  
  403. PROCEDURE CloseReq1;
  404. (* Schließen des Gadget-Windows. *)
  405.  
  406. BEGIN
  407.  IF (WPtr#NIL) THEN CloseWindow (WPtr) END;
  408. END CloseReq1;
  409.  
  410. (*--------------------------------------------------------------------------*)
  411.  
  412. PROCEDURE GetReq1GPtr (ID : INTEGER) : ADDRESS;
  413. (* Liefert den GadgetPtr des Gadgets mit der angegebenen ID. *)
  414.  
  415. BEGIN
  416.  RETURN ADR(Gadgets[ID]);
  417. END GetReq1GPtr;
  418.  
  419. (*--------------------------------------------------------------------------*)
  420.  
  421. BEGIN
  422.  WPtr := NIL;
  423. END Req1.